import Vue from "vue";
import Router from "vue-router";
import Login from "./components/login/login.vue";
import HTTPSTest from "./components/HTTPSTest.vue";
import StreamingMediaTest from "./components/StreamingMediaTest.vue";
import RealtimeStreaming from "./components/RealtimeStreaming.vue";
import Result from "./components/Result.vue";
import StreamControl from './components/StreamControl.vue';

Vue.use(Router);
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};

export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/login",
      name: "login",
      component: Login
    },
    {
      path: "/",
      name: "https-test",
      component: HTTPSTest,
      meta: {
        requiresAuth: true
      }
    },
    {
      path: "/url-test",
      name: "url-test",
      component: StreamingMediaTest,
      meta: {
        requiresAuth: true
      }
    },
    {
      path: "/rtmp",
      name: "rtmp",
      component: RealtimeStreaming,
      meta: {
        requiresAuth: true
      }
    },
    {
      path: "/result",
      name: "result",
      component: Result,
      meta: {
        requiresAuth: true
      }
    },
    {
      path: "/stream-control",
      name: "stream-control",
      component: StreamControl,
      meta: {
        requiresAuth: true
      }
    }
  ]
});
